package com.jianyun.jyzs.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.WebView;

/**
 * Created by mlli on 2017/12/20.
 */

public class JYWebView extends WebView{
    public JYWebView(Context context) {
        super(context);
    }

    public JYWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public JYWebView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (getScrollX()<0) {
//            touchLayout.getParent().requestDisallowInterceptTouchEvent(false);
            return false;
        } else if (getScrollX() >= computeHorizontalScrollRange()) {  //- getWidth()
            return false;
        } else {
            if (ev.getY()<100){
                getParent().requestDisallowInterceptTouchEvent(true);  //子view中,可以中断pager获取到事件
                return true;
            }

        }
        return super.onInterceptTouchEvent(ev);
    }
}
